<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" charset="UTF-8" href="/layui/css/layui.css">
    <script charset="UTF-8" rel="script" src="/layui/layui.js"></script>
    <script>
        layui.use(['layer', 'jquery', 'form'], function () {
            var $ = layui.jquery
                , layer = layui.layer
                .form = layui.form;

            $(document).ready(function () {
                $.ajax({
                    url: "/user/token",
                    data: {
                        name: "",
                        age: 18
                    },
                    type: "post",
                    dataType: "json",
                    success: function (result) {
                        console.log(result);
                        $("#token").html(result);
                    }
                });
            });
        });
    </script>
</head>
<body>
<form class="layui-form" action="/user/doLogin" method="post">

    <div class="layui-row">
        <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
            <div class="grid-demo grid-demo-bg1">&nbsp;</div>
        </div>
        <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
            <div class="grid-demo">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
                    <legend>用户登录</legend>
                </fieldset>
                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="username" lay-verify="title" autocomplete="off" placeholder="请输入用户名"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-inline">
                        <input type="password" name="userpassword" lay-verify="pass" placeholder="请输入密码"
                               autocomplete="off"
                               class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">验证码</label>
                    <div class="layui-input-inline">
                        <input type="text" name="token" lay-verify="title" autocomplete="off" placeholder="请输入验证码"
                               class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux" id="token"></div>
                </div>
                <input type="submit" lay-submit lay-filter="demo1" class="layui-btn layui-btn-normal"
                       value="登&nbsp;&nbsp;录" style="width: 100px; margin-left: 100px; margin-top:20px ;"/>
                <a href="" class="layui-btn" target="_parent"
                   style="margin-top:20px ;">&nbsp;&nbsp;&nbsp;&nbsp;注&nbsp;&nbsp;册&nbsp;&nbsp;&nbsp;&nbsp;</a>
            </div>
        </div>
    </div>
</form>
</body>
</html>